package com.han.spring.sboot;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

/**
* @author hanpeng
* @version 创建时间：2021年2月4日 上午10:05:47
* @ClassName 类名称
* @Description 类描述
*/
public class TestMy {
	private static  String bigFilePrefix="/fyh/tianQiong_3.0";
    private static  String bigFileSuffix="/part-00000";

	public static void main(String[] args) {
		long start=1611331200L*1000L;
		long end=1611590399L*1000L;
		System.out.println(getZZZByMills(start));
		System.out.println(getZZZByMills(end));
		System.out.println(getBigFilePathByTimeStamp(getZZZByMills(start)));//1611417600000
		System.out.println(getBigFilePathByTimeStamp(1611417600000L));
	}
	public  static  Long getZZZByMills(long timeMills) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTimeInMillis(timeMills);
        //calendar.setTime(new Date());
        calendar.set(Calendar.HOUR_OF_DAY, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        calendar.set(Calendar.MILLISECOND, 0);
        long zzzTimeMils=calendar.getTimeInMillis();
        return zzzTimeMils;
    }
	public  static   String  getBigFilePathByTimeStamp(long timeStamp) {
        final SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
        String yyyyMMdd = simpleDateFormat.format(new Date(timeStamp));
        String yyyy=yyyyMMdd.substring(0,4);
        String yyyyMM=yyyyMMdd.substring(0,6);
        return bigFilePrefix+"/"+yyyy+"/"+yyyyMM+"/"+yyyyMMdd+bigFileSuffix;
    }


}
